using AutoMapper;

namespace hao_Common.AutoMapper.Profiles
{
    /// <summary>
    /// AutoMapper 配置基类
    /// </summary>
    public abstract class BaseProfile : Profile
    {
        protected BaseProfile()
        {
            // 通用映射配置
            CreateMap<DateTime, DateTime?>().ConvertUsing(src => src);
            CreateMap<DateTime?, DateTime>().ConvertUsing(src => src ?? DateTime.MinValue);
            CreateMap<Guid, string>().ConvertUsing(src => src.ToString());
            CreateMap<string, Guid>().ConvertUsing(src => Guid.Parse(src));
        }
    }
}